<?php
@include_once( dirname(__FILE__).'/../../config/config.php' );
header("Content-type:image/png");

$img_height = 20;
$img_width = 60;
$im = @imagecreate( $img_width, $img_height );
$background_color = imagecolorallocate( $im, 255, 255, 255 );
$text_color = imagecolorallocate( $im, rand( 1, 121 ), rand( 1, 121 ), rand( 1, 121 ) );

for($i=1;$i<100;$i++)
{
	if ( $i % 2 == 0 )
	{
		$disturb_str = '+';
	}
	else
	{
		$disturb_str = '*';
	}
	imagestring( $im, 1, mt_rand( 1, $img_width ), mt_rand( 1, $img_height ), $disturb_str,
	imageColorAllocate( $im, mt_rand( 121, 255 ), mt_rand( 121, 255 ), mt_rand( 121, 255 ) ) );
}

while( ( $num = rand() % 10000 ) < 1000 );
{
}
$_SESSION['check_code'] = $num;
imagestring( $im, 4, 15, 2, $num, $text_color );
imagepng( $im );
imagedestroy( $im );